// AddFieldValue.cpp: implementation of the CAddFieldValue class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "AddFieldValue.h"
#include "MyUtility.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////


void CAddFieldValue::AutoFillValue(const char* packet,CComPtr<IComm> &m_CommX,int loopNum)
{
	vector<string> list;
	CMyUtility::Split(packet,"^",list);
	for (int i=1;i!=loopNum;i++)
	{
		m_CommX->AddValue(list.at(i).c_str());
	}
}
void CAddFieldValue::AddEntrustStock(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(13, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_account");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("entrust_prop");
	m_CommX->AddField("entrust_bs");
	AutoFillValue( packet,m_CommX,13);
}

void CAddFieldValue::AddEntrustPrice(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(14, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_account");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("entrust_price");
	m_CommX->AddField("entrust_prop");
	m_CommX->AddField("c_bs");
	AutoFillValue( packet,m_CommX,14);

}

void CAddFieldValue::AddEntrustConfirm(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(15, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	//m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_account");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("entrust_amount");
	m_CommX->AddField("entrust_price");
	m_CommX->AddField("entrust_prop");
	m_CommX->AddField("entrust_bs");
	m_CommX->AddField("c_bs");
	//m_CommX->AddField("external_no");
	//m_CommX->AddField("batch_no");
	AutoFillValue( packet,m_CommX,15);
}



void CAddFieldValue::AddEntrustCancel(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(12, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("batch_flag");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("entrust_no");
	m_CommX->AddField("external_no");
	
	AutoFillValue( packet,m_CommX,12);	
}


void CAddFieldValue::AddInquiryCaptialStream(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(10, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("request_num");
	m_CommX->AddField("position_str");
		
	AutoFillValue( packet,m_CommX,10);	
}

void CAddFieldValue::AddInquiryCapital(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(8, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");

	AutoFillValue( packet,m_CommX,8);	

}

void CAddFieldValue::AddInquirySettlementStream(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(17, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_branch_no");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("start_date");
	m_CommX->AddField("end_date");
	m_CommX->AddField("request_num");
	m_CommX->AddField("position_str");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_account");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("query_direction");
	AutoFillValue( packet,m_CommX,17);
}

void CAddFieldValue::AddInquiryQuote(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(4, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_code");
	AutoFillValue( packet,m_CommX,4);
}

void CAddFieldValue::AddInquiryEntrust(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(15, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("locate_entrust_no");
	m_CommX->AddField("query_direction");
	m_CommX->AddField("sort_direction");
	m_CommX->AddField("request_num");
	m_CommX->AddField("position_str");
	
	AutoFillValue( packet,m_CommX,15);
}


void CAddFieldValue::AddInquiryKnockdown(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(17, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("query_mode");
	m_CommX->AddField("request_num");
	m_CommX->AddField("serial_no");
	m_CommX->AddField("batch_serial_no");
	m_CommX->AddField("position_str");
	m_CommX->AddField("c_bs");
	m_CommX->AddField("external_no");
	AutoFillValue( packet,m_CommX,17);
	
}

void CAddFieldValue::AddInquiryStock(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(13, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("query_mode");
	m_CommX->AddField("request_num");
	m_CommX->AddField("position_str");
	
	
	AutoFillValue( packet,m_CommX,13);	
}


void CAddFieldValue::AddInquiryStockholder(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(12, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("query_direction");
	m_CommX->AddField("request_num");
		
	AutoFillValue( packet,m_CommX,12);	
}

void CAddFieldValue::AddInquiryHistoryKnockdown(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(15, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("start_date");
	m_CommX->AddField("end_date");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("external_no");
	m_CommX->AddField("c_bs");
	m_CommX->AddField("request_num");
	m_CommX->AddField("position_str");
	
	AutoFillValue( packet,m_CommX,15);	
}

void CAddFieldValue::AddInquiryHistoryCapitalSecurityStream(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(12, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("start_date");
	m_CommX->AddField("end_date");
	m_CommX->AddField("request_num");
	m_CommX->AddField("position_str");
	
	AutoFillValue( packet,m_CommX,12);		
}


void CAddFieldValue::AddMassInquiry(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(14, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("entrust_no");
	m_CommX->AddField("query_mode");
	m_CommX->AddField("request_num");
	m_CommX->AddField("position_str");

	AutoFillValue( packet,m_CommX,14);		
}


void CAddFieldValue::AddInquiryHistoryEntrust(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(13, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("start_date");
	m_CommX->AddField("end_date");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("request_num");
	m_CommX->AddField("position_str");
	
	AutoFillValue( packet,m_CommX,13);			
}

void CAddFieldValue::AddMassEntrust(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(20, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_branch_no");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("op_station");
	m_CommX->AddField("branch_no");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("entrust_num");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_account");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("entrust_price");
	m_CommX->AddField("entrust_amount");
	m_CommX->AddField("entrust_prop");
	m_CommX->AddField("entrust_bs");
	m_CommX->AddField("c_bs");
	m_CommX->AddField("external_no");
	m_CommX->AddField("batch_no");
	AutoFillValue( packet,m_CommX,20);		
}


void CAddFieldValue::AddMassEntrustCancel(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(8, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("op_station");
	m_CommX->AddField("l_count");
	m_CommX->AddField("entrust_no");
	m_CommX->AddField("external_no");

	AutoFillValue( packet,m_CommX,8);		
}

void CAddFieldValue::AddMassRiskControl(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(18, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("op_branch_no");
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("op_station");
	
	m_CommX->AddField("action_in");
	m_CommX->AddField("project_id");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("entrust_num");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_account");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("entrust_price");
	m_CommX->AddField("entrust_amount");
	m_CommX->AddField("occur_amount");
	m_CommX->AddField("entrust_bs");
	
	AutoFillValue( packet,m_CommX,18);		
	
}

void CAddFieldValue::AddMultiCreatePosition(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(24, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("vc_station_address");
	m_CommX->AddField("l_action_in");
	m_CommX->AddField("l_comb_id");
	m_CommX->AddField("l_part1_count");
	
	m_CommX->AddField("l_part2_count");
	m_CommX->AddField("l_count");
	m_CommX->AddField("vc_exchange_type_l");
	m_CommX->AddField("vc_stock_code_l");
	m_CommX->AddField("vc_target_amount_l");
	m_CommX->AddField("vc_base_price_l");
	m_CommX->AddField("vc_base_impact_l");
	m_CommX->AddField("vc_direct_l");
	m_CommX->AddField("vc_bs_l");
	m_CommX->AddField("vc_fund_account");
	m_CommX->AddField("vc_stock_account");
	m_CommX->AddField("c_business_type");
	m_CommX->AddField("c_arb_direct");
	m_CommX->AddField("en_base_profit");
	m_CommX->AddField("en_gap_price");
	m_CommX->AddField("l_hold_id");
	m_CommX->AddField("error_info");
	AutoFillValue( packet,m_CommX,24);		
}


void CAddFieldValue::AddMultiEntrust(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(18, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("c_entrust_way");
	m_CommX->AddField("vc_station_address");
	
	m_CommX->AddField("l_action_in");
	m_CommX->AddField("l_comb_id");
	
	m_CommX->AddField("l_comb_serial_no");
	m_CommX->AddField("l_count");
	m_CommX->AddField("vc_exchange_type_l");
	m_CommX->AddField("vc_stock_code_l");
	m_CommX->AddField("vc_entrust_amount_l");
	m_CommX->AddField("vc_entrust_price_l");
	
	m_CommX->AddField("vc_direct_l");
	m_CommX->AddField("vc_entrust_prop_l");
	m_CommX->AddField("vc_external_no_l");
	m_CommX->AddField("vc_bs_l");
	m_CommX->AddField("l_batch_no");
	AutoFillValue( packet,m_CommX,18);			
}



void CAddFieldValue::AddMultiEntrustCancel(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(13, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	m_CommX->AddField("c_entrust_way");
	m_CommX->AddField("vc_station_address");
	
	m_CommX->AddField("l_action_in");
	m_CommX->AddField("l_comb_id");
	
	m_CommX->AddField("l_comb_serial_no");
	m_CommX->AddField("l_count");
	m_CommX->AddField("vc_exchange_type_l");
	m_CommX->AddField("vc_stock_code_l");
	
	m_CommX->AddField("vc_direct_l");
	m_CommX->AddField("vc_bs_l");
	
	AutoFillValue( packet,m_CommX,13);		
}

void CAddFieldValue::AddMultiInquiryTransactionInfo(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(10, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	
	m_CommX->AddField("vc_station_address");
	
	m_CommX->AddField("l_action_in");
	m_CommX->AddField("l_comb_id");
	m_CommX->AddField("vc_comb_name");
	m_CommX->AddField("vc_business_type");
	m_CommX->AddField("c_idx_exchange_type");
	m_CommX->AddField("vc_idx_code");
		
	AutoFillValue( packet,m_CommX,10);		
}

void CAddFieldValue::AddMultiInquiryTransactionDetails(const char* packet,CComPtr<IComm> &m_CommX)
{	
	m_CommX->SetRange(6, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	
	m_CommX->AddField("vc_station_address");
	m_CommX->AddField("l_action_in");
	m_CommX->AddField("l_comb_id");
	
	AutoFillValue( packet,m_CommX,6);		
}


void CAddFieldValue::AddMultiInquiryAggregationPostion(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(11, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	
	m_CommX->AddField("vc_station_address");
	
	m_CommX->AddField("l_action_in");
	m_CommX->AddField("l_comb_id");
	m_CommX->AddField("l_comb_serial_no");
	m_CommX->AddField("l_construct_date_s");
	m_CommX->AddField("l_construct_date_e");
	m_CommX->AddField("l_base_comb_id");
	m_CommX->AddField("vc_business_type");
	
	AutoFillValue( packet,m_CommX,11);		
}

void CAddFieldValue::AddMultiInquiryEntrust(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(18, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("l_comb_serial_no");
	m_CommX->AddField("action_in");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("locate_entrust_no");
	m_CommX->AddField("query_direction");
	m_CommX->AddField("sort_direction");
	m_CommX->AddField("request_num");
	m_CommX->AddField("position_str");
	m_CommX->AddField("external_no");
	AutoFillValue( packet,m_CommX,18);
}

void CAddFieldValue::AddInquiryMultiEntrustKnockdown(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(18, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("l_comb_serial_no");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("query_mode");
	
	
	m_CommX->AddField("request_num");
	m_CommX->AddField("serial_no");
	m_CommX->AddField("batch_serial_no");
	m_CommX->AddField("position_str");
	m_CommX->AddField("c_bs");
	m_CommX->AddField("external_no");
	AutoFillValue( packet,m_CommX,18);	
}


void CAddFieldValue::AddMultiInquiryPositionDetails(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(8, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	
	m_CommX->AddField("vc_station_address");
	m_CommX->AddField("l_action_in");
	m_CommX->AddField("l_comb_id");
	m_CommX->AddField("l_comb_serial_no");
	m_CommX->AddField("l_batch_no");
	
	AutoFillValue( packet,m_CommX,8);	
}

void CAddFieldValue::AddMultiInquiryKnockdown(const char* packet,CComPtr<IComm> &m_CommX)
{
	m_CommX->SetRange(19, 1);
	m_CommX->AddField("version");
	m_CommX->AddField("l_op_code");
	m_CommX->AddField("vc_op_password");
	
	m_CommX->AddField("op_entrust_way");
	m_CommX->AddField("project_id");
	m_CommX->AddField("op_station");
	m_CommX->AddField("l_comb_serial_no");
	m_CommX->AddField("fund_account");
	m_CommX->AddField("password");
	
	
	m_CommX->AddField("exchange_type");
	m_CommX->AddField("stock_code");
	m_CommX->AddField("query_mode");
	m_CommX->AddField("request_num");
	m_CommX->AddField("serial_no");
	m_CommX->AddField("batch_serial_no");
	m_CommX->AddField("position_str");
	m_CommX->AddField("c_bs");
	m_CommX->AddField("external_no");
	m_CommX->AddField("action_in");
	AutoFillValue( packet,m_CommX,19);	
}